package com.example.fw;

import java.util.ArrayList;
import java.util.List;


import org.netbeans.jemmy.operators.JButtonOperator;
import org.netbeans.jemmy.operators.JDialogOperator;
import org.netbeans.jemmy.operators.JTextFieldOperator;
import org.netbeans.jemmy.operators.JTreeOperator;


public class FolderHelper extends HelperBase{
	
	public FolderHelper(ApplicationManager applicationManager) {
		super(applicationManager);
	}

	public Folders getFolders() {
		List<String> List = new ArrayList<String>();
		JTreeOperator tree = new JTreeOperator(mainFrame);
		Object[] children = tree.getChildren(tree.getRoot());
		for (Object child : children) {
			List.add("" + child);			
		}
		return new Folders(List);
	}

	public String createFolder(String folderName) {
		// nazhali na knopky
		manager.getMenuHelper().pushCreateFolder();
		JDialogOperator dialog = new JDialogOperator(mainFrame);
		new JTextFieldOperator(dialog).setText(folderName);
		new JButtonOperator(dialog, "OK").push();
		//dop. proverka: ne poyavilos li dialogovoe okno s soobscheniem
		return waitMassageDialog("Warning", 3000);
	}

	 
}
